#include "ParticleSystem.h"
#include <stdlib.h>
#include <stdio.h>

ParticleSystem::ParticleSystem()
{
    numParticles = 1;

    //allocate the particle atribute arrays
    pPosition = new float3[NUM_PARTICLES];
    pVelocity = new float3[NUM_PARTICLES];
    pForce    = new float3[NUM_PARTICLES];
    pColor    = new float3[NUM_PARTICLES];
    pRadius   = new float [NUM_PARTICLES];
    
    //initialize the particle atribute arrays
    int ix=0, iy=0, iz=0;
    for( int i=0; i<NUM_PARTICLES; ++i )
    {
        pPosition[i] = make_float3(((rand()/(float)RAND_MAX)*BOX_DIM)-(BOX_DIM/2.0f),
                                   BOX_DIM-4.0f,
                                   ((rand()/(float)RAND_MAX)*BOX_DIM)-(BOX_DIM/2.0f));

        pVelocity[i] = make_float3(((rand()/(float)RAND_MAX)*2)-(2/2.0f), 
                                   ((rand()/(float)RAND_MAX)*2)-(2/2.0f),
                                   ((rand()/(float)RAND_MAX)*2)-(2/2.0f));
        pForce[i]    = make_float3(0,0,0);
        pColor[i]    = make_float3((i+0.4f)/(float)NUM_PARTICLES , (i+0.5f)/(float)NUM_PARTICLES, 0.5f);
        pRadius[i]   = ((rand()/(float)RAND_MAX)*(MAX_RADIUS - MIN_RADIUS) + MIN_RADIUS);
    }
    
    buffOneInput = true;
}
